package com.cy.controller;

import com.cy.service.ConsumerHttpApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/consumer/echo/")
public class feignConsumerController {
    @Value("${spring.application.name}")
    private String appName;
    //feign API
    @Autowired
    private ConsumerHttpApi consumerHttpApi;
    //http://i:port/consumer/msg
    @GetMapping("{msg}")
    public  String doFeignEcho(@PathVariable String msg){
        //执行远程调用
        return consumerHttpApi.echoMessage(msg);
    }
}
